import axios from 'axios'

import * as constants from './constants'

const changeDetail = (title,content)=>({
    type:constants.CHANGE_DETAIL,
    title,
    content
})
export const getDatail=(id)=>{
   return (dispatch)=>{
       axios.get('/api/detail.json?id='+id).then((res)=>{
            const {data} = res.data;
           dispatch(changeDetail(data.title,data.content))
       })
   }
}